<%-- 
    Document   : homeAdmin
    Created on : Feb 27, 2012, 11:17:03 PM
    Author     : frances
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" href="../css/foo.css" type="text/css"></link>
        <link rel="stylesheet" type="text/css" href="../css/superfish.css" media="screen">	
        <title>Foobar</title>
        <script type="text/javascript" src="../js/jquery-1.7.1.min.js"></script>
        <script type="text/javascript" src="../js/hoverIntent.js"></script>
        <script type="text/javascript" src="../js/superfish.js"></script>
        <script type="text/javascript" src="http://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script>
        <script type="text/javascript">
            

            // initialise plugins
            jQuery(function(){
                jQuery('ul.sf-menu').superfish();
            });
            
            function checkAuth(){
                if(<%=request.getParameter("loginAttempt")%> == false){
                    document.write('<span class="errLog">Authentication failed.</span>');
                }
            }

        </script>
    </head>
    <body class="bg">
        <% if (request.getSession(true).getAttribute("username") == null) {
                response.sendRedirect("../login.jsp");
            }%>
        <script type="text/javascript">checkAuth();</script>
        <br/>

        <div class="hmenu">
            <% if (request.getSession(true).getAttribute("username") == null) {%>
            <p style="font-size: 12px; margin-top: -15px; float: right;">If you're not yet a member, sign up <a href="../signUp.jsp">here!</a> </p>   
            <% }%>
            <img src="../images/head.png" style="float: left; margin-left:20px;"></img>
            <div class="log">
                <% if (request.getSession(true).getAttribute("username") != null) {%>
                <h3>Welcome <%=session.getAttribute("username")%>!</h3>
                <br/>
                <!--                insert stuff-->
                <a href="../LogoutServlet">Log out</a>
                <% } else {%>
                <span style="font-weight: bold;">Log in</span>
                <form method="post" action="../LoginServlet">
                    <label>Username:</label><input type="text" name="username"/><br/>
                    <label>Password:</label><input type="password" name="password"/><br/>
                    <input type="submit" value="Log in" name="submit"/>
                </form>
                <% }%>
            </div>
            <% if (request.getSession(true).getAttribute("username") != null && session.getAttribute("acctype").equals("admin")) {%>
            <ul class="sf-menu">
                <li class="current">
                    <a href="admin.jsp">Home</a>  
                </li>
                <li>
                    <a href="addProdAccnt.jsp">Add Manager</a>
                </li>
                <li>
                    <a href="lockAccount.jsp">Lock/Unlock Account</a>
                </li>
                <li>
                    <a href="viewUserlist.jsp">User List</a>

                </li>
            </ul>
            <%  } else {%>
            <ul class="sf-menu">
                <li class="current">
                    <a href="index.jsp">Home</a>
                </li>
                <li>
                    <a href="#">Products</a>
                    <ul>
                        <li>
                            <a href="#">Book</a>
                        </li>
                        <li>
                            <a href="#">Magazine</a>
                        </li>
                        <li>
                            <a href="#">Audio CD</a>
                        </li>
                        <li>
                            <a href="#">DVD</a>
                        </li>
                    </ul>
                </li>
                <li>
                    <a href="#">Stores</a>
                </li>
                <li>
                    <a href="#">Contact Us</a>
                </li>
                <li>
                    <a>SEARCH FUNCTION HERE</a>
                </li>
            </ul>
            <% }%>
        </div>
        <div class="content">
            <% if (request.getSession(true).getAttribute("username") != null && session.getAttribute("acctype").equals("admin")) {%>
            <b>Welcome to Foobar</b>
            <br/>
            Online bookstore made available for you!<br/>
            <hr /> 
            <p align="center">-Top selling products are showcased here-</p>
            <script type="text/javascript">getdate();</script><br>
            <script type="text/javascript">gettime();</script><br>
            <% } else {%>
            <h1>Oops! We don't think you're allowed to be here.</h1>
            <span>Please log in with the correct user credentials</span>
            <% }%>
        </div>
    </body>
</html>
